
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Nested Column Headers</title>

<style type="text/css">
/*margin and padding on body element
  can introduce errors in determining
  element position and are not recommended;
  we turn them off as a foundation for YUI
  CSS treatments. */
body {
	margin:0;
	padding:0;
}
</style>

<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
<script type="text/javascript" src="../../build/yui/yui-min.js"></script>


<!--begin custom header content for this example-->
<style type="text/css">
/* custom styles for this example */
.dt-example {margin:1em;}

/* css to counter global site css */
.dt-example th {text-transform:none;}
.dt-example table {width:auto;}
.dt-example caption {display:table-caption;}
</style>
<!--end custom header content for this example-->

</head>

<body class="yui3-skin-sam  yui-skin-sam">

<h1>Nested Column Headers</h1>

<div class="exampleIntro">
	<p>The DataTable widget supports nested column headers, which can be defined in the columnset definition using the <code>children</code> configuration.</p>			
</div>

<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->

<div id="nested" class="dt-example"></div>

<script type="text/javascript">
YUI({ filter: 'raw' }).use("datatable-base", function (Y) {
    var nestedCols = [
        {label:"Train Schedule", children:[
            {key: "track"},
            {label:"Route", children: [
                {key:"from"},
                {key:"to"}
            ]}
        ]}
    ],
    data = [
        {track:"1", from:"Paris", to:"Amsterdam"},
        {track:"2", from:"Paris", to:"London"},
        {track:"3", from:"Paris", to:"Zurich"}
    ],

    cs = new Y.Columnset({definitions:nestedCols}),
    dt = new Y.DataTable.Base({columnset:nestedCols, recordset:data, summary:"Train schedule", caption:"Table with nested column headers"}).render("#nested");
});
</script>

<!--END SOURCE CODE FOR EXAMPLE =============================== -->

</body>
</html>
